// g++ -O3 -g glumain.cpp test.cpp math.cpp -std=gnu++0x -DGL_GLEXT_PROTOTYPES -lGL -lglut

#include <stdio.h>

#include "test.h"
#include <GL/freeglut.h>

Test g_test;

void display()
{
  g_test.render();
  glutSwapBuffers();
}

void reshape(int width, int height)
{
  g_test.resize(width, height);
}

int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB);
  glutInitWindowSize(800, 600);
  glutCreateWindow("perf test");

#ifdef _WIN32
  GLenum glewErr = glewInit();
  if(glewErr != GLEW_OK)
  {
      fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(glewErr));
      abort();
  }
#endif

  g_test.init();
  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutIdleFunc(display);
  glutMainLoop();
  return 0;
}
